<template>
<view>
    <view class="store-item" v-for="store in stores" :key="store.id" @click="handleClick(store._id)">
      <img :src="store.imgUrl" class="store-logo">
      <view class="store-info">
        <view><text class="store-name">{{store.name}}</text></view>
        <view><text class="store-data">月售: {{store.sales}}&nbsp; 起送: {{store.expressLimit}}&nbsp; 基础运费: {{store.expressPrice}}</text></view>
        <view><text class="coupon" v-if="store.slogan">{{store.slogan}}</text></view>
      </view>
    </view>
</view>
    
</template>

<script>
	import Config from '@/Config.js'
export default {
  data() {
    return {
      stores: []
    };
  },

  onReady() {
        uni.request({
            url: Config.api_host+'/data',
            success: (res) => {
                console.log(res.data);
                this.stores = res.data;
            }
        });
    },
    methods: {
    handleClick(id) {
        console.log(id)
      
        uni.navigateTo({
         url:`/pages/detail/detail?id=${id}`,
        });
      
    },
    
  },
 
  
};
</script>

<style scoped>
.store-item {
  display: flex;
  align-items: center;
  border-bottom: 1px solid #ccc;
  padding: 10px 0;
}

.store-logo {
  width: 80px;
  height: 80px;
}

.store-info {
  margin-left: 10px;
}

.store-name {
  font-size: 16px;
}

.store-data {
  font-size: 14px;
  color: #666;
}

.coupon {
  color: red;
  font-size: 14px;
}
</style>